package com.yocard.yxyd.ui.presenter;

import com.yocard.yxyd.base.CommonSubscriber;
import com.yocard.yxyd.base.RxPresenter;
import com.yocard.yxyd.http.HttpManager;
import com.yocard.yxyd.http.model.request.OrderListRequest;
import com.yocard.yxyd.http.model.response.InviteRecord;
import com.yocard.yxyd.http.model.response.OrderListBean;
import com.yocard.yxyd.ui.contract.InviteRecordListContract;
import com.yocard.yxyd.utils.RxUtil;

import javax.inject.Inject;

/**
 * Created on 2019/5/28
 * 邀请记录
 */
public class InviteRecordListPresenter extends RxPresenter<InviteRecordListContract.View> implements InviteRecordListContract.Presenter {

    @Inject
    public InviteRecordListPresenter(HttpManager manager) {
        super(manager);
    }

    @Override
    public void fetchOrderList(int currentPage, String status) {
        addSubscribe(httpManager.getInviteList(currentPage, status)
                .compose(RxUtil.rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<InviteRecord>(mView) {

                    @Override
                    public void onSuccess(InviteRecord data) {
                        try {
                            mView.OnfetchOrderList(data.getData());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }));

    }
}
